package com.ecfront.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;

import com.ecfront.dao.GoodsSortDAO;
import com.ecfront.pojo.GoodsSort;
import com.ecfront.service.GoodsSortService;

public class GoodsSortServiceImpl implements GoodsSortService {
	//日志文件
	private static Logger log = Logger.getLogger(GoodsSortServiceImpl.class.getName());
	//注入dao接口
	protected GoodsSortDAO goodsSortDao;
	
	public void setGoodsSortDao(GoodsSortDAO goodsSortDao) {
		this.goodsSortDao = goodsSortDao;
	}
	/**
	 * 返回所有大类
	 * @return 商品大类
	 */
	public List<String> getFirstGoodsSort() {
		List<String> list = new ArrayList<String>();
		List<GoodsSort> goodsSorts = goodsSortDao.findByGooGsid(0);
		if(list!=null){
			for(Iterator<GoodsSort> iter = goodsSorts.iterator();iter.hasNext();){
				GoodsSort gs = iter.next();
				list.add(gs.getName());
			}
			return list;
		}
		return null;
	}

}
